package uk.co.q3c.deplan.client.ui.view;

import uk.co.q3c.deplan.client.Orchestrator;
import uk.co.q3c.deplan.client.ui.component.VerticalFlowPanel;
import uk.co.q3c.deplan.client.ui.presenter.Presenter;
import uk.co.q3c.deplan.client.util.Q3StringUtil;

public class Q3ViewBase implements Q3CoreView {
	protected VerticalFlowPanel basePanel;
	protected Presenter presenter;
	private boolean initialised;

	public Q3ViewBase() {
		super();
		basePanel = new VerticalFlowPanel();
	}

	public boolean isInitialised() {
		return initialised;
	}

	private boolean flushed;

	@Override
	public long getViewedObjectId() {
		return Orchestrator.viewManager()
				.getViewedObjectId(this);
	}

	@Override
	public Viewtags viewTag() {
		String thisName = Q3StringUtil.simpleNameFromClassName(this.getClass()
				.getName());
		thisName = thisName.substring(0, thisName.length() - 3);
		return Viewtags.valueOf(thisName);
	}

	@Override
	public void reset() {

	}

	@Override
	public void init() {

	}

	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;
	}

	@Override
	public Presenter getPresenter() {
		return presenter;
	}

	@Override
	public boolean isFlushed() {
		return flushed;
	}

	@Override
	public VerticalFlowPanel basePanel() {
		return basePanel;
	}
}
